package com.itheima_01;

import java.util.Scanner;

public class StringDemo7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String s = sc.nextLine();
        System.out.println("----------");
        //替换敏感词
        String s1 = s.replace("TMD", "***");
        System.out.println(s1);
        /*char[] ch = s.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            if(ch[i] == 'T' && ch[i+1] == 'M' && ch[i+2] == 'D') {
                ch[i] = '*';
                ch[i+1] = '*';
                ch[i+2] = '*';
            }
            System.out.print(ch[i]);
        }*/
    }
}
